namespace AdmissionQA.Domain.Entities;

/// <summary>
/// 常见问题实体
/// </summary>
public class Issue : EntityBase
{
    /// <summary>
    /// 问题
    /// </summary>
    public string Question { get; set; }

    /// <summary>
    /// 答案
    /// </summary>
    public string Answer { get; set; }

    /// <summary>
    /// 向量化Embedding字段
    /// </summary>
    public float[]? Embedding { get; set; }

    /// <summary>
    /// 构造函数
    /// </summary>
    private Issue(string question, string answer)
    {
        Question = question;
        Answer = answer;
    }

    /// <summary>
    /// 创建常见问题
    /// </summary>
    public static Issue? CreateIssue(string question, string answer)
    {
        // 可以加入一些判断

        return new Issue(question, answer);
    }

    /// <summary>
    /// 更新常见问题信息
    /// </summary>
    public bool UpdateIssue(string newQuestion, string newAnswer, string? newDescription)
    {
        // 可以加入一些判断

        Question = newQuestion;
        Answer = newAnswer;
        Description = newDescription;
        return true;
    }
}
